package demo1;

public class Animal {

    public String name;
    public int age;
    public void eat(){
        System.out.println(this.name+"正在吃饭");
    }

    public Animal(String name, int age) {
        this.name = name;
        this.age = age;
        System.out.println("Animal 构造方法");
    }
    static{
        System.out.println("Animal static......");
    }

    {
        System.out.println("Animal 实例");
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    @Override
    public String toString() {
        return "Animal{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }
}
